import { handleCommonResult } from '../../utils/resolver.js';
import { getHZPlayerConfig } from '../../api/index.js';

function getKey(type) {
  return '__PLAYER_CONFIG_' + String(type).toLocaleUpperCase();
}

async function getConfigureAsync(type) {
  const res = await getHZPlayerConfig({ type }).catch(() => {});
  return handleCommonResult(res, { defaultValue: {} });
}

export async function getConfigure(type) {
  if (!type) {
    return {};
  }
  return await getConfigureAsync(type);
}
